﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using NewDDSys.DATAOUT;
using System.IO;
using System.Reflection;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Web;


public partial class Web_ZDHHB : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        ExcelEdit report = new ExcelEdit();
        report.CreateExcel();
        report.CreateWorkSheet("早调会汇报表");
        report.CellsUnite(1, 1, 1, 11);
        report.WriteData("指标情况", 1, 1);
        report.CellsAlignment(1, 1, 1, 11, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 1, 3, 1);
        report.WriteData("库区", 2, 1);
        report.CellsAlignment(2, 1, 3, 1, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 2, 3, 2);
        report.WriteData("运输处计划", 2, 2);
        report.CellsAlignment(2, 2, 3, 2, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 3, 3, 3);
        report.WriteData("总站计划", 2, 3);
        report.CellsAlignment(2, 3, 3, 3, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 4, 2, 5);
        report.WriteData("全天实际配车数", 2, 4);
        report.CellsAlignment(2, 4, 2, 5, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.WriteData("好车", 3, 4);
        report.WriteData("坏车", 3, 5);
        report.CellsUnite(2, 6, 2, 7);
        report.WriteData("外发", 2, 6);
        report.CellsAlignment(2, 6, 2, 7, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.WriteData("夜班", 3, 6);
        report.WriteData("白班", 3, 7);
        string Tday = DateTime.Now.AddDays(-1).ToShortDateString().ToString();
        string ty = Convert.ToDateTime(Tday).AddHours(8).ToString();
        string ty1 = Convert.ToDateTime(ty).AddHours(-12).ToString();
        string tb = Convert.ToDateTime(Tday).AddHours(20).ToString();
        string Nday = DateTime.Now.ToShortDateString().ToString();
        string Ny = Convert.ToDateTime(Nday).AddHours(8).ToString();
        string Nkukc = "";
        string Tkukc = "";
        decimal Nkc = 0;
        decimal Tkc = 0;
        decimal rkl = 0;
        string xckc = "";
        string bckc = "";
        string data1 = Tday + "日夜班";
        report.CellsUnite(2, 8, 3, 8);
        report.WriteData(data1, 2, 8);
        report.CellsAlignment(2, 8, 3, 8, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 9, 3, 9);
        report.WriteData("倒库", 2, 9);
        report.CellsAlignment(2, 9, 3, 9, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 10, 3, 10);
        report.WriteData("零提t", 2, 10);
        report.CellsAlignment(2, 10, 3, 10, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 11, 3, 11);
        report.WriteData("计划超欠", 2, 11);
        report.CellsAlignment(2, 11, 3, 11, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        int wfhj = 0;
        int dkhj = 0;
        decimal lthj = 0;
        int jhcqhj = 0;
        int sjwf = 0;
        string ysjh = "";
        string zzjh = "";
        
        string good = "";
        string bad = "";
        string yb = "";
        string ybw = "";
        string yby = "";
        string ybc = "";
        string bb = "";
        string bbw = "";
        string bby = "";
        string bbc = "";
        string Nyb = "";
        string wycl = "";
        string dk = "";
        string dkycl = "";
        string dkwcl = "";
        string ltd = "";
        string lty = "";
        string ltw = "";
        int bbwf = 0;
        int edkwcl = 0;
        decimal eltwcl = 0;
        decimal kuckly = 0;
        decimal kuckl = 0;
        decimal lt = 0;
        string ckyds = "";
        DataSet ds1 = null;
        DataSet ds2 = null;
        DataSet ds3 = null;
        DataSet ds4 = null;
        DataSet ds5 = null;
        DataSet ds6 = null;
        DataSet ds7 = null;
        DataSet ds8 = null;
        DataSet ds9 = null;
        DataSet ds10 = null;
        DataSet ds11 = null;
        DataSet ds12 = null;
        DataSet ds13 = null;
        DataSet ds14 = null;
        DataSet ds15 = null;
        decimal kchj = 0;
        decimal rkhj = 0;
        decimal ckhj = 0;
        string[] sjd = { "嘉东线材", "嘉东螺纹", "嘉东卷板", "嘉东板材" };
        int si = 4;
        foreach (string jdk in sjd)
        {
            report.WriteData(jdk, si, 1);
            report.WriteData(jdk, si, 12);
            switch(jdk)
            {
                case "嘉东线材":
                    {
                        ysjh = BLLFactory.CreateYsjhBLL().JDXC();
                        report.WriteData(ysjh, si, 2);
                        zzjh = BLLFactory.CreateHcrBLL().KURJH(jdk, Tday);
                        int zzxc = 0;
                        if (zzjh != "")
                            zzxc = Convert.ToInt32(zzjh);
                        report.WriteData(zzjh, si, 3);
                        ds1 = BLLFactory.CreateWorkBLL().dbck(jdk, Tday);
                        good = ds1.Tables[0].Rows[0]["gcs"].ToString();
                        report.WriteData(good, si, 4);
                        bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
                        report.WriteData(bad, si, 5);
                        yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "夜"));

                        ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, jdk, "外发");
                        ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
                        int xcybwcl = 0;
                        if (ybw != "")
                            xcybwcl = Convert.ToInt32(ybw);
                        ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "外发");
                        yby = ds4.Tables[0].Rows[0]["csy"].ToString();
                        int xcybycl = 0;
                        if (yby != "")
                            xcybycl = Convert.ToInt32(yby);
                        int xcybcs = 0;
                        if (yb != "")
                            xcybcs = Convert.ToInt32(yb);
                        wfhj = xcybycl + xcybcs + wfhj;
                        sjwf = xcybycl + xcybcs;
                        ybc = (xcybycl - xcybwcl + xcybcs).ToString();
                        xcybycl = 0;
                        xcybwcl = 0;
                        xcybcs = 0;
                        report.WriteData(ybc, si, 6);
                        bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "白"));

                        int xcbbcs = 0;
                        if (bb != "")
                            xcbbcs = Convert.ToInt32(bb);

                        ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "外发");
                        bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
                        int xcbbwcl = 0;
                        if (bbw != "")
                            xcbbwcl = Convert.ToInt32(bbw);
                        bbwf = bbwf + xcbbwcl;
                        ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "外发");
                        bby = ds6.Tables[0].Rows[0]["csy"].ToString();
                        ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = Convert.ToDecimal(ckyds);
                        int xcbbycl = 0;
                        if (bby != "")
                            xcbbycl = Convert.ToInt32(bby);
                        wfhj = xcbbcs - xcbbwcl + wfhj;
                        sjwf = sjwf + xcbbcs - xcbbwcl;
                        bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
                        xcbbcs = 0;
                        xcbbycl = 0;
                        xcbbwcl = 0;
                        report.WriteData(bbc, si, 7);
                        Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Nday, "夜"));
                        ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, jdk, "外发");
                        wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
                        int xcwyclcs = 0;
                        if (wycl != "")
                            xcwyclcs = Convert.ToInt32(wycl);
                        int xcNybcs = 0;
                        if (Nyb != "")
                            xcNybcs = Convert.ToInt32(Nyb);
                        int xcNwfcs = xcNybcs + xcwyclcs;
                        report.WriteData(xcNwfcs.ToString(), si, 8);
                        xcwyclcs = 0;
                        xcNybcs = 0;
                        xcNwfcs = 0;
                        ds2 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "倒库", Tday);
                        dk = ds2.Tables[0].Rows[0]["cs"].ToString();
                        int xcdkcs = 0;
                        if (dk != "")
                            xcdkcs = Convert.ToInt32(dk);
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "倒库");
                        dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
                        int xcdkycs = 0;
                        if (dkycl != "")
                            xcdkycs = Convert.ToInt32(dkycl);
                        ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "倒库");
                        dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
                        int xcdkwcs = 0;
                        if (dkwcl != "")
                            xcdkwcs = Convert.ToInt32(dkwcl);
                        edkwcl = edkwcl + xcdkwcs;
                        sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "倒库");
                        ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = kuckly + Convert.ToDecimal(ckyds);
                        int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
                        dkhj = dkhj + xcdcs;
                        report.WriteData(xcdcs.ToString(), si, 9);
                        xcdkcs = 0;
                        xcdkycs = 0;
                        xcdkwcs = 0;
                        int xcqc = sjwf - zzxc;
                        zzxc = 0;
                        sjwf = 0;
                        jhcqhj = jhcqhj + xcqc;
                        report.WriteData(xcqc.ToString(), si, 11);
                        xcqc = 0;
                        ds10 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "零提", Tday);
                        ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
                        decimal xcltds = 0;
                        if (ltd != "")
                            xcltds = Convert.ToDecimal(ltd);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        decimal xcltyds = 0;
                        if (lty != "")
                            xcltyds = Convert.ToDecimal(lty);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        if (lty != "")
                            kuckly = kuckly + Convert.ToDecimal(lty);
                        
                        ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "零提");
                        ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();
                        
                        decimal xcltwds = 0;
                        if (ltw != "")
                            xcltwds = Convert.ToDecimal(ltw);
                        eltwcl = eltwcl + xcltwds;
                        lt = xcltds + xcltyds - xcltwds;
                        xcltds = 0;
                        xcltyds = 0;
                        xcltwds = 0;
                        report.WriteData(lt.ToString("f2"), si, 10);
                        lthj = lthj + lt;
                        lt = 0;
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, jdk));
                        report.WriteData((kuckl + kuckly).ToString("f2"), si, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        Tkukc = BLLFactory.CreateXkcdtBLL().JDXC(Tday);
                        Nkukc = BLLFactory.CreateXkcdtBLL().JDXC(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        report.WriteData((Nkc).ToString("f2"), si, 15);
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData((rkl).ToString("f2"), si, 13);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                        
                        
                    }; break;
                case "嘉东螺纹":
                    {
                        ysjh = BLLFactory.CreateYsjhBLL().JDBC();
                        report.WriteData(ysjh, si, 2);
                        zzjh = BLLFactory.CreateHcrBLL().KURJH(jdk, Tday);
                        int zzxc = 0;
                        if (zzjh != "")
                            zzxc = Convert.ToInt32(zzjh);
                        report.WriteData(zzjh, si, 3);
                        ds1 = BLLFactory.CreateWorkBLL().dbck(jdk, Tday);
                        good = ds1.Tables[0].Rows[0]["gcs"].ToString();
                        report.WriteData(good, si, 4);
                        bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
                        report.WriteData(bad, si, 5);
                        yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "夜"));

                        ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, jdk, "外发");
                        ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
                        int xcybwcl = 0;
                        if (ybw != "")
                            xcybwcl = Convert.ToInt32(ybw);
                        ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "外发");
                        yby = ds4.Tables[0].Rows[0]["csy"].ToString();
                        int xcybycl = 0;
                        if (yby != "")
                            xcybycl = Convert.ToInt32(yby);
                        int xcybcs = 0;
                        if (yb != "")
                            xcybcs = Convert.ToInt32(yb);
                        wfhj = xcybycl + xcybcs + wfhj;
                        sjwf = xcybycl + xcybcs;
                        ybc = (xcybycl - xcybwcl + xcybcs).ToString();
                        xcybycl = 0;
                        xcybwcl = 0;
                        xcybcs = 0;
                        report.WriteData(ybc, si, 6);
                        bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "白"));

                        int xcbbcs = 0;
                        if (bb != "")
                            xcbbcs = Convert.ToInt32(bb);

                        ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "外发");
                        bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
                        int xcbbwcl = 0;
                        if (bbw != "")
                            xcbbwcl = Convert.ToInt32(bbw);
                        bbwf = bbwf + xcbbwcl;
                        ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "外发");
                        bby = ds6.Tables[0].Rows[0]["csy"].ToString();
                        ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = Convert.ToDecimal(ckyds);
                        int xcbbycl = 0;
                        if (bby != "")
                            xcbbycl = Convert.ToInt32(bby);
                        wfhj = xcbbcs - xcbbwcl + wfhj;
                        sjwf = sjwf + xcbbcs - xcbbwcl;
                        bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
                        xcbbcs = 0;
                        xcbbycl = 0;
                        xcbbwcl = 0;
                        report.WriteData(bbc, si, 7);
                        Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Nday, "夜"));
                        ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, jdk, "外发");
                        wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
                        int xcwyclcs = 0;
                        if (wycl != "")
                            xcwyclcs = Convert.ToInt32(wycl);
                        int xcNybcs = 0;
                        if (Nyb != "")
                            xcNybcs = Convert.ToInt32(Nyb);
                        int xcNwfcs = xcNybcs + xcwyclcs;
                        report.WriteData(xcNwfcs.ToString(), si, 8);
                        xcwyclcs = 0;
                        xcNybcs = 0;
                        xcNwfcs = 0;
                        ds2 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "倒库", Tday);
                        dk = ds2.Tables[0].Rows[0]["cs"].ToString();
                        int xcdkcs = 0;
                        if (dk != "")
                            xcdkcs = Convert.ToInt32(dk);
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "倒库");
                        dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
                        int xcdkycs = 0;
                        if (dkycl != "")
                            xcdkycs = Convert.ToInt32(dkycl);
                        ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "倒库");
                        dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
                        int xcdkwcs = 0;
                        if (dkwcl != "")
                            xcdkwcs = Convert.ToInt32(dkwcl);
                        edkwcl = edkwcl + xcdkwcs;
                        sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "倒库");
                        ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = kuckly + Convert.ToDecimal(ckyds);
                        int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
                        dkhj = dkhj + xcdcs;
                        report.WriteData(xcdcs.ToString(), si, 9);
                        xcdkcs = 0;
                        xcdkycs = 0;
                        xcdkwcs = 0;
                        int xcqc = sjwf - zzxc;
                        zzxc = 0;
                        sjwf = 0;
                        jhcqhj = jhcqhj + xcqc;
                        report.WriteData(xcqc.ToString(), si, 11);
                        xcqc = 0;
                        ds10 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "零提", Tday);
                        ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
                        decimal xcltds = 0;
                        if (ltd != "")
                            xcltds = Convert.ToDecimal(ltd);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        decimal xcltyds = 0;
                        if (lty != "")
                            xcltyds = Convert.ToDecimal(lty);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        if (lty != "")
                            kuckly = kuckly + Convert.ToDecimal(lty);

                        ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "零提");
                        ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();

                        decimal xcltwds = 0;
                        if (ltw != "")
                            xcltwds = Convert.ToDecimal(ltw);
                        eltwcl = eltwcl + xcltwds;
                        lt = xcltds + xcltyds - xcltwds;
                        xcltds = 0;
                        xcltyds = 0;
                        xcltwds = 0;
                        report.WriteData(lt.ToString("f2"), si, 10);
                        lthj = lthj + lt;
                        lt = 0;
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, jdk));
                        report.WriteData((kuckl + kuckly).ToString("f2"), si, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        Tkukc = BLLFactory.CreateBkcdtBLL().JDBC(Tday);
                        Nkukc = BLLFactory.CreateBkcdtBLL().JDBC(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        report.WriteData((Nkc).ToString("f2"), si, 15);
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData((rkl).ToString("f2"), si, 13);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                        
                        
                    }; break;
                case "嘉东卷板":
                    {
                        ysjh = BLLFactory.CreateYsjhBLL().JDJB();
                        report.WriteData(ysjh, si, 2);
                        zzjh = BLLFactory.CreateHcrBLL().KURJH(jdk, Tday);
                        int zzxc = 0;
                        if (zzjh != "")
                            zzxc = Convert.ToInt32(zzjh);
                        report.WriteData(zzjh, si, 3);
                        ds1 = BLLFactory.CreateWorkBLL().dbck(jdk, Tday);
                        good = ds1.Tables[0].Rows[0]["gcs"].ToString();
                        report.WriteData(good, si, 4);
                        bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
                        report.WriteData(bad, si, 5);
                        yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "夜"));

                        ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, jdk, "外发");
                        ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
                        int xcybwcl = 0;
                        if (ybw != "")
                            xcybwcl = Convert.ToInt32(ybw);
                        ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "外发");
                        yby = ds4.Tables[0].Rows[0]["csy"].ToString();
                        int xcybycl = 0;
                        if (yby != "")
                            xcybycl = Convert.ToInt32(yby);
                        int xcybcs = 0;
                        if (yb != "")
                            xcybcs = Convert.ToInt32(yb);
                        wfhj = xcybycl + xcybcs + wfhj;
                        sjwf = xcybycl + xcybcs;
                        ybc = (xcybycl - xcybwcl + xcybcs).ToString();
                        xcybycl = 0;
                        xcybwcl = 0;
                        xcybcs = 0;
                        report.WriteData(ybc, si, 6);
                        bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "白"));

                        int xcbbcs = 0;
                        if (bb != "")
                            xcbbcs = Convert.ToInt32(bb);

                        ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "外发");
                        bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
                        int xcbbwcl = 0;
                        if (bbw != "")
                            xcbbwcl = Convert.ToInt32(bbw);
                        bbwf = bbwf + xcbbwcl;
                        ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "外发");
                        bby = ds6.Tables[0].Rows[0]["csy"].ToString();
                        ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = Convert.ToDecimal(ckyds);
                        int xcbbycl = 0;
                        if (bby != "")
                            xcbbycl = Convert.ToInt32(bby);
                        wfhj = xcbbcs - xcbbwcl + wfhj;
                        sjwf = sjwf + xcbbcs - xcbbwcl;
                        bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
                        xcbbcs = 0;
                        xcbbycl = 0;
                        xcbbwcl = 0;
                        report.WriteData(bbc, si, 7);
                        Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Nday, "夜"));
                        ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, jdk, "外发");
                        wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
                        int xcwyclcs = 0;
                        if (wycl != "")
                            xcwyclcs = Convert.ToInt32(wycl);
                        int xcNybcs = 0;
                        if (Nyb != "")
                            xcNybcs = Convert.ToInt32(Nyb);
                        int xcNwfcs = xcNybcs + xcwyclcs;
                        report.WriteData(xcNwfcs.ToString(), si, 8);
                        xcwyclcs = 0;
                        xcNybcs = 0;
                        xcNwfcs = 0;
                        ds2 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "倒库", Tday);
                        dk = ds2.Tables[0].Rows[0]["cs"].ToString();
                        int xcdkcs = 0;
                        if (dk != "")
                            xcdkcs = Convert.ToInt32(dk);
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "倒库");
                        dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
                        int xcdkycs = 0;
                        if (dkycl != "")
                            xcdkycs = Convert.ToInt32(dkycl);
                        ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "倒库");
                        dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
                        int xcdkwcs = 0;
                        if (dkwcl != "")
                            xcdkwcs = Convert.ToInt32(dkwcl);
                        edkwcl = edkwcl + xcdkwcs;
                        sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "倒库");
                        ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = kuckly + Convert.ToDecimal(ckyds);
                        int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
                        dkhj = dkhj + xcdcs;
                        report.WriteData(xcdcs.ToString(), si, 9);
                        xcdkcs = 0;
                        xcdkycs = 0;
                        xcdkwcs = 0;
                        int xcqc = sjwf - zzxc;
                        zzxc = 0;
                        sjwf = 0;
                        jhcqhj = jhcqhj + xcqc;
                        report.WriteData(xcqc.ToString(), si, 11);
                        xcqc = 0;
                        ds10 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "零提", Tday);
                        ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
                        decimal xcltds = 0;
                        if (ltd != "")
                            xcltds = Convert.ToDecimal(ltd);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        decimal xcltyds = 0;
                        if (lty != "")
                            xcltyds = Convert.ToDecimal(lty);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        if (lty != "")
                            kuckly = kuckly + Convert.ToDecimal(lty);

                        ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "零提");
                        ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();

                        decimal xcltwds = 0;
                        if (ltw != "")
                            xcltwds = Convert.ToDecimal(ltw);
                        eltwcl = eltwcl + xcltwds;
                        lt = xcltds + xcltyds - xcltwds;
                        xcltds = 0;
                        xcltyds = 0;
                        xcltwds = 0;
                        report.WriteData(lt.ToString("f2"), si, 10);
                        lthj = lthj + lt;
                        lt = 0;
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, jdk));
                        report.WriteData((kuckl + kuckly).ToString("f2"), si, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        Tkukc = BLLFactory.CreateRkcdtBLL().JDJB(Tday);
                        Nkukc = BLLFactory.CreateRkcdtBLL().JDJB(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        report.WriteData((Nkc).ToString("f2"), si, 15);
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData((rkl).ToString("f2"), si, 13);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                        
                        
                    }; break;
                case "嘉东板材":
                    {
                        ysjh = BLLFactory.CreateYsjhBLL().JDZB();
                        report.WriteData(ysjh, si, 2);
                        zzjh = BLLFactory.CreateHcrBLL().KURJH(jdk, Tday);
                        int zzxc = 0;
                        if (zzjh != "")
                            zzxc = Convert.ToInt32(zzjh);
                        report.WriteData(zzjh, si, 3);
                        ds1 = BLLFactory.CreateWorkBLL().dbck(jdk, Tday);
                        good = ds1.Tables[0].Rows[0]["gcs"].ToString();
                        report.WriteData(good, si, 4);
                        bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
                        report.WriteData(bad, si, 5);
                        yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "夜"));

                        ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, jdk, "外发");
                        ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
                        int xcybwcl = 0;
                        if (ybw != "")
                            xcybwcl = Convert.ToInt32(ybw);
                        ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "外发");
                        yby = ds4.Tables[0].Rows[0]["csy"].ToString();
                        int xcybycl = 0;
                        if (yby != "")
                            xcybycl = Convert.ToInt32(yby);
                        int xcybcs = 0;
                        if (yb != "")
                            xcybcs = Convert.ToInt32(yb);
                        wfhj = xcybycl + xcybcs + wfhj;
                        sjwf = xcybycl + xcybcs;
                        ybc = (xcybycl - xcybwcl + xcybcs).ToString();
                        xcybycl = 0;
                        xcybwcl = 0;
                        xcybcs = 0;
                        report.WriteData(ybc, si, 6);
                        bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "白"));

                        int xcbbcs = 0;
                        if (bb != "")
                            xcbbcs = Convert.ToInt32(bb);

                        ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "外发");
                        bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
                        int xcbbwcl = 0;
                        if (bbw != "")
                            xcbbwcl = Convert.ToInt32(bbw);
                        bbwf = bbwf + xcbbwcl;
                        ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "外发");
                        bby = ds6.Tables[0].Rows[0]["csy"].ToString();
                        ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = Convert.ToDecimal(ckyds);
                        int xcbbycl = 0;
                        if (bby != "")
                            xcbbycl = Convert.ToInt32(bby);
                        wfhj = xcbbcs - xcbbwcl + wfhj;
                        sjwf = sjwf + xcbbcs - xcbbwcl;
                        bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
                        xcbbcs = 0;
                        xcbbycl = 0;
                        xcbbwcl = 0;
                        report.WriteData(bbc, si, 7);
                        Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Nday, "夜"));
                        ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, jdk, "外发");
                        wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
                        int xcwyclcs = 0;
                        if (wycl != "")
                            xcwyclcs = Convert.ToInt32(wycl);
                        int xcNybcs = 0;
                        if (Nyb != "")
                            xcNybcs = Convert.ToInt32(Nyb);
                        int xcNwfcs = xcNybcs + xcwyclcs;
                        report.WriteData(xcNwfcs.ToString(), si, 8);
                        xcwyclcs = 0;
                        xcNybcs = 0;
                        xcNwfcs = 0;
                        ds2 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "倒库", Tday);
                        dk = ds2.Tables[0].Rows[0]["cs"].ToString();
                        int xcdkcs = 0;
                        if (dk != "")
                            xcdkcs = Convert.ToInt32(dk);
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "倒库");
                        dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
                        int xcdkycs = 0;
                        if (dkycl != "")
                            xcdkycs = Convert.ToInt32(dkycl);
                        ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "倒库");
                        dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
                        int xcdkwcs = 0;
                        if (dkwcl != "")
                            xcdkwcs = Convert.ToInt32(dkwcl);
                        edkwcl = edkwcl + xcdkwcs;
                        sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "倒库");
                        ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = kuckly + Convert.ToDecimal(ckyds);
                        int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
                        dkhj = dkhj + xcdcs;
                        report.WriteData(xcdcs.ToString(), si, 9);
                        xcdkcs = 0;
                        xcdkycs = 0;
                        xcdkwcs = 0;
                        int xcqc = sjwf - zzxc;
                        zzxc = 0;
                        sjwf = 0;
                        jhcqhj = jhcqhj + xcqc;
                        report.WriteData(xcqc.ToString(), si, 11);
                        xcqc = 0;
                        ds10 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "零提", Tday);
                        ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
                        decimal xcltds = 0;
                        if (ltd != "")
                            xcltds = Convert.ToDecimal(ltd);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        decimal xcltyds = 0;
                        if (lty != "")
                            xcltyds = Convert.ToDecimal(lty);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        if (lty != "")
                            kuckly = kuckly + Convert.ToDecimal(lty);

                        ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "零提");
                        ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();

                        decimal xcltwds = 0;
                        if (ltw != "")
                            xcltwds = Convert.ToDecimal(ltw);
                        eltwcl = eltwcl + xcltwds;
                        lt = xcltds + xcltyds - xcltwds;
                        xcltds = 0;
                        xcltyds = 0;
                        xcltwds = 0;
                        report.WriteData(lt.ToString("f2"), si, 10);
                        lthj = lthj + lt;
                        lt = 0;
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, jdk));
                        report.WriteData((kuckl + kuckly).ToString("f2"), si, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        Tkukc = BLLFactory.CreateZkcdtBLL().JDZB(Tday);
                        Nkukc = BLLFactory.CreateZkcdtBLL().JDZB(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        report.WriteData((Nkc).ToString("f2"), si, 15);
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData((rkl).ToString("f2"), si, 13);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                        
                    }; break;
                default:
                    break;
            }
            si++;
            
        }
        string[] s1 = { "板材库", "不锈钢热轧库", "不锈钢冷轧库", "碳钢热轧库", "碳钢冷轧库", "一高线", "二高线", "大棒线", "四轧库", "酸洗库", "化产库" };
        int j = 8;
        
        foreach (string ku in s1)
        {
            report.WriteData(ku, j, 1);
            report.WriteData(ku, j, 12);
            ysjh = BLLFactory.CreateHweekplanBLL().jhcs(ku, "运输处", Tday);
            report.WriteData(ysjh, j, 2);
            zzjh = BLLFactory.CreateHcrBLL().KURJH(ku, Tday);
            int zz = 0;
            if (zzjh != "")
                zz = Convert.ToInt32(zzjh);
            report.WriteData(zzjh, j, 3);
            ds1 = BLLFactory.CreateWorkBLL().dbck(ku, Tday);
            good = ds1.Tables[0].Rows[0]["gcs"].ToString();
            report.WriteData(good, j, 4);
            bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
            report.WriteData(bad, j, 5);
            yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(ku, Tday, "夜"));

            ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, ku, "外发");
            ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
            int xcybwcl = 0;
            if (ybw != "")
                xcybwcl = Convert.ToInt32(ybw);
            ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, ku, "外发");
            yby = ds4.Tables[0].Rows[0]["csy"].ToString();
            int xcybycl = 0;
            if (yby != "")
                xcybycl = Convert.ToInt32(yby);
            int xcybcs = 0;
            if (yb != "")
                xcybcs = Convert.ToInt32(yb);
            wfhj = xcybycl + xcybcs + wfhj;
            sjwf = xcybycl + xcybcs;
            ybc = (xcybycl - xcybwcl + xcybcs).ToString();
            xcybycl = 0;
            xcybwcl = 0;
            xcybcs = 0;
            report.WriteData(ybc, j, 6);
            bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(ku, Tday, "白"));

            int xcbbcs = 0;
            if (bb != "")
                xcbbcs = Convert.ToInt32(bb);

            ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, ku, "外发");
            bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
            int xcbbwcl = 0;
            if (bbw != "")
                xcbbwcl = Convert.ToInt32(bbw);
            bbwf = bbwf + xcbbwcl;
            ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, ku, "外发");
            bby = ds6.Tables[0].Rows[0]["csy"].ToString();
            ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
            if (ckyds != "")
                kuckly = Convert.ToDecimal(ckyds);
            int xcbbycl = 0;
            if (bby != "")
                xcbbycl = Convert.ToInt32(bby);
            wfhj = xcbbcs - xcbbwcl + wfhj;
            sjwf = sjwf + xcbbcs - xcbbwcl;
            bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
            xcbbcs = 0;
            xcbbycl = 0;
            xcbbwcl = 0;
            report.WriteData(bbc, j, 7);
            Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(ku, Nday, "夜"));
            ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, ku, "外发");
            wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
            int xcwyclcs = 0;
            if (wycl != "")
                xcwyclcs = Convert.ToInt32(wycl);
            int xcNybcs = 0;
            if (Nyb != "")
                xcNybcs = Convert.ToInt32(Nyb);
            int xcNwfcs = xcNybcs + xcwyclcs;
            report.WriteData(xcNwfcs.ToString(), j, 8);
            xcwyclcs = 0;
            xcNybcs = 0;
            xcNwfcs = 0;
            ds2 = BLLFactory.CreateWorkBLL().cdbykpz(ku, "倒库", Tday);
            dk = ds2.Tables[0].Rows[0]["cs"].ToString();
            int xcdkcs = 0;
            if (dk != "")
                xcdkcs = Convert.ToInt32(dk);
            ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, ku, "倒库");
            dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
            int xcdkycs = 0;
            if (dkycl != "")
                xcdkycs = Convert.ToInt32(dkycl);
            ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, ku, "倒库");
            dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
            int xcdkwcs = 0;
            if (dkwcl != "")
                xcdkwcs = Convert.ToInt32(dkwcl);
            edkwcl = edkwcl + xcdkwcs;
            sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
            ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, ku, "倒库");
            ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
            if (ckyds != "")
                kuckly = kuckly + Convert.ToDecimal(ckyds);
            int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
            dkhj = dkhj + xcdcs;
            report.WriteData(xcdcs.ToString(), j, 9);
            xcdkcs = 0;
            xcdkycs = 0;
            xcdkwcs = 0;
            int xcqc = sjwf - zz;
            zz = 0;
            sjwf = 0;
            jhcqhj = jhcqhj + xcqc;
            report.WriteData(xcqc.ToString(), j, 11);
            xcqc = 0;
            ds10 = BLLFactory.CreateWorkBLL().cdbykpz(ku, "零提", Tday);
            ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
            decimal xcltds = 0;
            if (ltd != "")
                xcltds = Convert.ToDecimal(ltd);
            ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, ku, "零提");
            lty = ds11.Tables[0].Rows[0]["duny"].ToString();
            decimal xcltyds = 0;
            if (lty != "")
                xcltyds = Convert.ToDecimal(lty);
            ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, ku, "零提");
            lty = ds11.Tables[0].Rows[0]["duny"].ToString();
            if (lty != "")
                kuckly = kuckly + Convert.ToDecimal(lty);

            ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, ku, "零提");
            ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();

            decimal xcltwds = 0;
            if (ltw != "")
                xcltwds = Convert.ToDecimal(ltw);
            eltwcl = eltwcl + xcltwds;
            lt = xcltds + xcltyds - xcltwds;
            xcltds = 0;
            xcltyds = 0;
            xcltwds = 0;
            report.WriteData(lt.ToString("f2"), j, 10);
            lthj = lthj + lt;
            lt = 0;
            
            switch (ku)
            {
                case "一高线":
                    {
                        xckc = BLLFactory.CreateXkcdtBLL().KuKC(Nday, ku);
                        decimal Nxckc = 0;
                        if (xckc != "")
                            Nxckc = Convert.ToDecimal(xckc);
                        decimal Nbckc = 0;
                        bckc = BLLFactory.CreateBkcdtBLL().KuKC(Nday, ku);
                        if (bckc != "")
                            Nbckc = Convert.ToDecimal(bckc);
                        kchj = kchj + Nxckc + Nbckc;
                        report.WriteData((Nxckc + Nbckc).ToString("f2"), j, 15);
                        xckc = BLLFactory.CreateXkcdtBLL().KuKC(Tday, ku);
                        decimal Txckc = 0;
                        if (xckc != "")
                            Txckc = Convert.ToDecimal(xckc);
                        bckc = BLLFactory.CreateBkcdtBLL().KuKC(Tday, ku);
                        decimal Tbckc = 0;
                        if (bckc != "")
                            Tbckc = Convert.ToDecimal(bckc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        report.WriteData((kuckl + kuckly).ToString("f2"), j, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = (Nxckc + Nbckc) - ((Txckc + Tbckc) - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData(rkl.ToString("f2"), j, 13);
                        
                        rkl = 0;
                        Nxckc = 0;
                        Nbckc = 0;
                        Txckc = 0;
                        Tbckc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;
                case "二高线":
                    {
                        Tkukc = BLLFactory.CreateXkcdtBLL().KuKC(Tday, ku);
                        Nkukc = BLLFactory.CreateXkcdtBLL().KuKC(Nday, ku);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        report.WriteData((Nkc).ToString("f2"), j, 15);
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        report.WriteData((kuckl + kuckly).ToString("f2"), j, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData((rkl).ToString("f2"), j, 13);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;
                case "大棒线":
                case "四轧库":
                    {
                        Tkukc = BLLFactory.CreateBkcdtBLL().KuKC(Tday, ku);
                        Nkukc = BLLFactory.CreateBkcdtBLL().KuKC(Nday, ku);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        report.WriteData((Nkc).ToString("f2"), j, 15);
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        report.WriteData((kuckl + kuckly).ToString("f2"), j, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData((rkl).ToString("f2"), j, 13);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;

                case "不锈钢热轧库":
                case "碳钢热轧库":
                case "酸洗库":
                    {
                        Tkukc = BLLFactory.CreateRkcdtBLL().KuKC(Tday, ku);
                        Nkukc = BLLFactory.CreateRkcdtBLL().KuKC(Nday, ku);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        report.WriteData((Nkc).ToString("f2"), j, 15);
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        report.WriteData((kuckl + kuckly).ToString("f2"), j, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData((rkl).ToString("f2"), j, 13);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;
                case "板材库":
                    {
                        Tkukc = BLLFactory.CreateZkcdtBLL().KuKC(Tday);
                        Nkukc = BLLFactory.CreateZkcdtBLL().KuKC(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        report.WriteData((Nkc).ToString("f2"), j, 15);
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        report.WriteData((kuckl + kuckly).ToString("f2"), j, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData((rkl).ToString("f2"), j, 13);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;
                case "不锈钢冷轧库":
                case "碳钢冷轧库":
                    {
                        Tkukc = BLLFactory.CreateLkcdtBLL().KuKC(Tday, ku);
                        Nkukc = BLLFactory.CreateLkcdtBLL().KuKC(Nday, ku);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        report.WriteData((Nkc).ToString("f2"), j, 15);
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        report.WriteData((kuckl + kuckly).ToString("f2"), j, 14);
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        report.WriteData((rkl).ToString("f2"), j, 13);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;
                
                default:
                    break;
            }
            
            j++;
        }
        
        report.WriteData("合计", 19, 1);
        string yshj = BLLFactory.CreateYsjhBLL().RHJ(Tday);
        report.WriteData(yshj, 19, 2);
        string zzhj = BLLFactory.CreateHcrBLL().RHJ(Tday);
        report.WriteData(zzhj, 19, 3);
        string ghj = BLLFactory.CreateWorkBLL().GoodHJ(Tday);
        report.WriteData(ghj, 19, 4);
        string bhj = BLLFactory.CreateWorkBLL().BadHJ(Tday);
        report.WriteData(bhj, 19, 5);
        report.CellsUnite(19, 6, 19, 7);
        
        report.WriteData(wfhj.ToString(), 19, 6);
        report.CellsAlignment(19, 6, 19, 7, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.WriteData(dkhj.ToString(), 19, 9);
        report.WriteData(lthj.ToString("f2"), 19, 10);
        report.WriteData(jhcqhj.ToString(), 19, 11);
        string kday = BLLFactory.CreateWorkBLL().FristDay();
        DateTime bt = Convert.ToDateTime(kday).AddDays(-3).AddHours(20);
        DateTime et = Convert.ToDateTime(Tday).AddHours(20);
        string jhks = Convert.ToDateTime(kday).AddDays(-2).ToShortDateString().ToString();
        ds13 = BLLFactory.CreateDxcBLL().YNRYCL(bt.ToString(), "外发");
        string ywfycl = ds13.Tables[0].Rows[0]["csy"].ToString();
        int ywfj = 0;
        if (ywfycl != "")
            ywfj = Convert.ToInt32(ywfycl);
        int ywfl = Convert.ToInt32(BLLFactory.CreateWorkBLL().YWF(bt.ToString(), et.ToString()));
        int ywfhj = ywfl + ywfj - bbwf; 
        ds14 = BLLFactory.CreateDxcBLL().YNRYCL(bt.ToString(), "倒库");
        string ydkycl = ds14.Tables[0].Rows[0]["csy"].ToString();
        int ydkj = 0;
        if (ydkycl != "")
            ydkj = Convert.ToInt32(ydkycl);
        int ydkl = Convert.ToInt32(BLLFactory.CreateWorkBLL().YDK(bt.ToString(), et.ToString()));
        int ydkhj = ydkl + ydkj - edkwcl;
        ds15 = BLLFactory.CreateDxcBLL().YNRYCL(bt.ToString(), "零提");
        string yltycl = ds15.Tables[0].Rows[0]["duny"].ToString();
        decimal yltj = 0;
        if (yltycl != "")
            yltj = Convert.ToDecimal(yltycl);
        decimal yltl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().YLT(bt.ToString(), et.ToString()));
        decimal ylthj = yltl + yltj - eltwcl;
        report.WriteData("月累计", 20, 1);
        report.WriteData(BLLFactory.CreateYsjhBLL().YHJ(jhks, Tday), 20, 2);
        report.WriteData(BLLFactory.CreateHcrBLL().YHJ(jhks, Tday), 20, 3);
        report.WriteData(BLLFactory.CreateWorkBLL().YGoodHJ(bt.ToString(), et.ToString()), 20, 4);
        report.WriteData(BLLFactory.CreateWorkBLL().YBadHJ(bt.ToString(), et.ToString()), 20, 5);
        report.CellsUnite(20, 6, 20, 7);
        report.WriteData(ywfhj.ToString(), 20, 6);
        report.CellsAlignment(20, 6, 20, 7, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.WriteData(ydkhj.ToString(), 20, 9);
        report.WriteData(ylthj.ToString("f2"), 20, 10);
        report.CellsUnite(1, 12, 1, 15);
        report.WriteData("出入库情况", 1, 12);
        report.CellsAlignment(1, 12, 1, 15, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 12, 3, 12);
        report.WriteData("库区", 2, 12);
        report.CellsAlignment(2, 12, 3, 12, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 13, 3, 13);
        report.WriteData("入库量", 2, 13);
        report.CellsAlignment(2, 13, 3, 13, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 14, 3, 14);
        report.WriteData("出库量", 2, 14);
        report.CellsAlignment(2, 14, 3, 14, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(2, 15, 3, 15);
        report.WriteData("库存", 2, 15);
        report.CellsAlignment(2, 15, 3, 15, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.WriteData("嘉东库回倒方坯", 19, 12);
        string fprk = BLLFactory.CreateGpwfBLL().FPDK(Nday);
        
        string fpck = BLLFactory.CreateGpwfBLL().FPCK(Nday);
        
        string fpkc = BLLFactory.CreateGpwfBLL().DKFPKC(Nday);
        
        report.WriteData(fprk, 19, 13);
        report.WriteData(fpck, 19, 14);
        report.WriteData(fpkc, 19, 15);
        report.WriteData("嘉东库回倒板坯", 20, 12);
        string bprk = BLLFactory.CreateGpwfBLL().BPDK(Nday);
        
        string bpck = BLLFactory.CreateGpwfBLL().BPCK(Nday);
        
        string bpkc = BLLFactory.CreateGpwfBLL().DKBPKC(Nday);
        
        report.WriteData(bprk, 20, 13);
        report.WriteData(bpck, 20, 14);
        report.WriteData(bpkc, 20, 15);
        report.WriteData("炼轧方坯", 21, 12);
        string lzck = BLLFactory.CreateGpwfBLL().LZCFPCK(Nday);
        report.WriteData("合计", 18, 12);
        report.WriteData(ckhj.ToString("f2"), 18, 14);
        report.WriteData(rkhj.ToString("f2"), 18, 13);
        report.WriteData(kchj.ToString("f2"), 18, 15);
        ckhj = 0;
        rkhj = 0;
        kchj = 0;
        string TFpkc = BLLFactory.CreateGpwfBLL().LZCFPKC(Tday);
        string NFpkc = BLLFactory.CreateGpwfBLL().LZCFPKC(Nday);
        decimal lzckl = 0;
        if (lzck != "")
            lzckl = Convert.ToDecimal(lzck);
        decimal TFK = 0;
        if (TFpkc != "")
            TFK = Convert.ToDecimal(TFpkc);
        decimal NFK = 0;
        if (NFpkc != "")
            NFK = Convert.ToDecimal(NFpkc);
        
        
        
        decimal Lfr = NFK - (TFK - lzckl);
        report.WriteData(Lfr.ToString("f2"), 21, 13);
        report.WriteData(lzck, 21, 14);
        report.WriteData(NFpkc, 21, 15);
        report.CellsUnite(22, 12, 22, 15);
        report.WriteData("嘉东库备注信息", 22, 12);
        report.CellsAlignment(22, 12, 22, 15, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.WriteData("班别", 23, 12);
        report.CellsUnite(23, 13, 23, 15);
        report.WriteData("备注信息", 23, 13);
        report.CellsAlignment(23, 13, 23, 15, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);

        DataSet ds16 = BLLFactory.CreateJbBLL().JDJBInfo(Nday);
        report.CellsUnite(24, 13, 24, 15);
        report.WriteData(ds16.Tables[0].Rows[0]["banbie"].ToString(), 24, 12);
        report.WriteData(ds16.Tables[0].Rows[0]["info"].ToString(), 24, 13);
        report.CellsAlignment(25, 13, 25, 15, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(25, 13, 25, 15);
        report.WriteData(ds16.Tables[0].Rows[1]["banbie"].ToString(), 25, 12);
        report.WriteData(ds16.Tables[0].Rows[1]["info"].ToString(), 25, 13);
        report.CellsAlignment(25, 13, 25, 15, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        
        

        report.WriteData("自用材", 26, 12);
        string zyhj = BLLFactory.CreateZkcdtBLL().ZYL(Nday);
        report.WriteData(zyhj, 26, 13);
        report.WriteData("河西库库存", 27, 12);
        string kchx = BLLFactory.CreateJddxBLL().hxkc();
        report.WriteData(kchx, 27, 13);
        report.WriteData("嘉东大棒", 28, 12);
        string dbkc = BLLFactory.CreateBkcdtBLL().DBJD(Nday);
        report.WriteData(dbkc, 28, 13);
        report.WriteData("总库存上涨", 29, 12);
        string kc1 = BLLFactory.CreateXkcdtBLL().ZKC(Tday);
        decimal c1 = 0;
        if (kc1 != "")
            c1 = Convert.ToDecimal(kc1);
        string kc2 = BLLFactory.CreateBkcdtBLL().ZKC(Tday);
        decimal c2 = 0;
        if (kc2 != "")
            c2 = Convert.ToDecimal(kc2);
        string kc3 = BLLFactory.CreateRkcdtBLL().ZKC(Tday);
        decimal c3 = 0;
        if (kc3 != "")
            c3 = Convert.ToDecimal(kc3);
        string kc4 = BLLFactory.CreateLkcdtBLL().ZKC(Tday);
        decimal c4 = 0;
        if (kc4 != "")
            c4 = Convert.ToDecimal(kc4);
        string kc5 = BLLFactory.CreateZkcdtBLL().ZKC(Tday);
        decimal c5 = 0;
        if (kc5 != "")
            c5 = Convert.ToDecimal(kc5);
        decimal kcsz = kchj - (c1 + c2 + c3 + c4 + c5);
        report.WriteData(kcsz.ToString("f2"), 29, 13);
        report.CellsUnite(21, 1, 21, 11);
        report.WriteData("调度信息", 21, 1);
        report.CellsAlignment(21, 1, 21, 11, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.WriteData("外部参考信息", 22, 1);
        report.WriteData("生产分析", 23, 1);
        report.WriteData("设备情况", 24, 1);
        report.WriteData("质量情况", 25, 1);
        report.WriteData("安全情况", 26, 1);
        report.WriteData("零提延时合计时间", 27, 1);
        DataSet ds17 = BLLFactory.CreateDdhbBLL().ddinfo();
        string wbqk = ds17.Tables[0].Rows[0]["wb"].ToString();
        string scqk = ds17.Tables[0].Rows[0]["sc"].ToString();
        string sbqk = ds17.Tables[0].Rows[0]["sb"].ToString();
        string zlqk = ds17.Tables[0].Rows[0]["zl"].ToString();
        string aqqk = ds17.Tables[0].Rows[0]["aq"].ToString();
        report.CellsUnite(22, 2, 22, 11);
        report.WriteData(wbqk, 22, 2);
        report.CellsAlignment(22, 2, 22, 11, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(23, 2, 23, 11);
        report.WriteData(scqk, 23, 2);
        report.CellsAlignment(23, 2, 23, 11, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(24, 2, 24, 11);
        report.WriteData(sbqk, 24, 2);
        report.CellsAlignment(24, 2, 24, 11, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(25, 2, 25, 11);
        report.WriteData(zlqk, 25, 2);
        report.CellsAlignment(25, 2, 25, 11, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        report.CellsUnite(26, 2, 26, 11);
        report.WriteData(aqqk, 26, 2);
        report.CellsAlignment(26, 2, 26, 11, ExcelEdit.ExcelHAlign.居中, ExcelEdit.ExcelVAlign.居中);
        string yslt = BLLFactory.CreateWorkBLL().ltyshj(Tday);
        report.WriteData(yslt, 27, 2);
        //"zbqk\\"
        string title = Session["用户信息.单位"].ToString() + Session["用户信息.姓名"].ToString() + DateTime.Now.ToString("yyyyMMdd").Trim() + "早调会汇报表";
        string savepath = "zbqk\\" + title + ".xls";
        string RepPath = Server.MapPath(savepath);

        report.SaveAs(RepPath); //文档路径
        report.Close();
        string filename = title + ".xls";

        string spath = "zbqk\\" + filename;
        string RPath = Server.MapPath(spath);
        FileInfo f = new FileInfo(RPath);
        if (f.Exists)
        {

            Response.Clear();
            Response.ClearContent();
            Response.ClearHeaders();
            Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(filename, System.Text.Encoding.UTF8));
            Response.ContentType = "application/msexcel";
            Response.WriteFile(RPath);
            Response.Flush();
            Response.Close();
            f.Delete();
        }

    }






    protected void Button2_Click(object sender, EventArgs e)
    {
        string Tday = DateTime.Now.AddDays(-1).ToShortDateString().ToString();
        string ty = Convert.ToDateTime(Tday).AddHours(8).ToString();
        string ty1 = Convert.ToDateTime(ty).AddHours(-12).ToString();
        string tb = Convert.ToDateTime(Tday).AddHours(20).ToString();
        string Nday = DateTime.Now.ToShortDateString().ToString();
        string Ny = Convert.ToDateTime(Nday).AddHours(8).ToString();
        string Nkukc = "";
        string Tkukc = "";
        decimal Nkc = 0;
        decimal Tkc = 0;
        decimal rkl = 0;
        string xckc = "";
        string bckc = "";
        int wfhj = 0;
        int dkhj = 0;
        decimal lthj = 0;
        int jhcqhj = 0;
        int sjwf = 0;
        string ysjh = "";
        string zzjh = "";

        string good = "";
        string bad = "";
        string yb = "";
        string ybw = "";
        string yby = "";
        string ybc = "";
        string bb = "";
        string bbw = "";
        string bby = "";
        string bbc = "";
        string Nyb = "";
        string wycl = "";
        string dk = "";
        string dkycl = "";
        string dkwcl = "";
        string ltd = "";
        string lty = "";
        string ltw = "";
        int bbwf = 0;
        int edkwcl = 0;
        decimal eltwcl = 0;
        decimal kuckly = 0;
        decimal kuckl = 0;
        decimal lt = 0;
        string ckyds = "";
        DataSet ds1 = null;
        DataSet ds2 = null;
        DataSet ds3 = null;
        DataSet ds4 = null;
        DataSet ds5 = null;
        DataSet ds6 = null;
        DataSet ds7 = null;
        DataSet ds8 = null;
        DataSet ds9 = null;
        DataSet ds10 = null;
        DataSet ds11 = null;
        DataSet ds12 = null;
        decimal kchj = 0;
        decimal rkhj = 0;
        decimal ckhj = 0;
        System.Data.DataTable dtResult1 = MakeNamesTable1();
        System.Data.DataTable dtResult2 = MakeNamesTable2();
        
        
        string[] sjd = { "嘉东线材", "嘉东螺纹", "嘉东卷板", "嘉东板材" };
        foreach (string jdk in sjd)
        {
            System.Data.DataRow dtRow1 = dtResult1.NewRow();
            System.Data.DataRow dtRow2 = dtResult2.NewRow();
            dtRow1["Ku"] = jdk;
            dtRow2["Ku"] = jdk;
            switch(jdk)
            {
                case "嘉东线材":
                    {
                        ysjh = BLLFactory.CreateYsjhBLL().JDXC();
                        dtRow1["Ysjh"] = ysjh;
                        zzjh = BLLFactory.CreateHcrBLL().KURJH(jdk, Tday);
                        int zzxc = 0;
                        if (zzjh != "")
                            zzxc = Convert.ToInt32(zzjh);
                        dtRow1["Zzjh"] = zzjh;
                        ds1 = BLLFactory.CreateWorkBLL().dbck(jdk, Tday);
                        good = ds1.Tables[0].Rows[0]["gcs"].ToString();
                        dtRow1["Good"] = good;
                        bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
                        dtRow1["Bad"] = bad;
                        yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "夜"));

                        ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, jdk, "外发");
                        ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
                        int xcybwcl = 0;
                        if (ybw != "")
                            xcybwcl = Convert.ToInt32(ybw);
                        ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "外发");
                        yby = ds4.Tables[0].Rows[0]["csy"].ToString();
                        int xcybycl = 0;
                        if (yby != "")
                            xcybycl = Convert.ToInt32(yby);
                        int xcybcs = 0;
                        if (yb != "")
                            xcybcs = Convert.ToInt32(yb);
                        wfhj = xcybycl + xcybcs + wfhj;
                        sjwf = xcybycl + xcybcs;
                        ybc = (xcybycl - xcybwcl + xcybcs).ToString();
                        xcybycl = 0;
                        xcybwcl = 0;
                        xcybcs = 0;
                        dtRow1["Yb"] = ybc;
                        bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "白"));

                        int xcbbcs = 0;
                        if (bb != "")
                            xcbbcs = Convert.ToInt32(bb);

                        ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "外发");
                        bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
                        int xcbbwcl = 0;
                        if (bbw != "")
                            xcbbwcl = Convert.ToInt32(bbw);
                        bbwf = bbwf + xcbbwcl;
                        ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "外发");
                        bby = ds6.Tables[0].Rows[0]["csy"].ToString();
                        ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = Convert.ToDecimal(ckyds);
                        int xcbbycl = 0;
                        if (bby != "")
                            xcbbycl = Convert.ToInt32(bby);
                        wfhj = xcbbcs - xcbbwcl + wfhj;
                        sjwf = sjwf + xcbbcs - xcbbwcl;
                        bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
                        xcbbcs = 0;
                        xcbbycl = 0;
                        xcbbwcl = 0;
                        dtRow1["Bb"] = bbc;
                        Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Nday, "夜"));
                        ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, jdk, "外发");
                        wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
                        int xcwyclcs = 0;
                        if (wycl != "")
                            xcwyclcs = Convert.ToInt32(wycl);
                        int xcNybcs = 0;
                        if (Nyb != "")
                            xcNybcs = Convert.ToInt32(Nyb);
                        int xcNwfcs = xcNybcs + xcwyclcs;
                        dtRow1["Nyb"] = xcNwfcs.ToString();
                        xcwyclcs = 0;
                        xcNybcs = 0;
                        xcNwfcs = 0;
                        ds2 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "倒库", Tday);
                        dk = ds2.Tables[0].Rows[0]["cs"].ToString();
                        int xcdkcs = 0;
                        if (dk != "")
                            xcdkcs = Convert.ToInt32(dk);
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "倒库");
                        dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
                        int xcdkycs = 0;
                        if (dkycl != "")
                            xcdkycs = Convert.ToInt32(dkycl);
                        ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "倒库");
                        dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
                        int xcdkwcs = 0;
                        if (dkwcl != "")
                            xcdkwcs = Convert.ToInt32(dkwcl);
                        edkwcl = edkwcl + xcdkwcs;
                        sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "倒库");
                        ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = kuckly + Convert.ToDecimal(ckyds);
                        int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
                        dkhj = dkhj + xcdcs;
                        dtRow1["Dk"] = xcdcs.ToString();
                        xcdkcs = 0;
                        xcdkycs = 0;
                        xcdkwcs = 0;
                        int xcqc = sjwf - zzxc;
                        zzxc = 0;
                        sjwf = 0;
                        jhcqhj = jhcqhj + xcqc;
                        dtRow1["Jhcq"] = xcqc.ToString();
                        xcqc = 0;
                        ds10 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "零提", Tday);
                        ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
                        decimal xcltds = 0;
                        if (ltd != "")
                            xcltds = Convert.ToDecimal(ltd);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        decimal xcltyds = 0;
                        if (lty != "")
                            xcltyds = Convert.ToDecimal(lty);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        if (lty != "")
                            kuckly = kuckly + Convert.ToDecimal(lty);

                        ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "零提");
                        ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();

                        decimal xcltwds = 0;
                        if (ltw != "")
                            xcltwds = Convert.ToDecimal(ltw);
                        eltwcl = eltwcl + xcltwds;
                        lt = xcltds + xcltyds - xcltwds;
                        xcltds = 0;
                        xcltyds = 0;
                        xcltwds = 0;
                        dtRow1["Lt"] = lt.ToString("f2");
                        lthj = lthj + lt;
                        lt = 0;
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, jdk));
                        dtRow2["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        Tkukc = BLLFactory.CreateXkcdtBLL().JDXC(Tday);
                        Nkukc = BLLFactory.CreateXkcdtBLL().JDXC(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        dtRow2["Kc"] = (Nkc).ToString("f2");
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow2["Rk"] = (rkl).ToString("f2");
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                        
                        dtResult1.Rows.Add(dtRow1);
                        dtResult2.Rows.Add(dtRow2);
                        
                    }; break;
                case "嘉东螺纹":
                    {
                        ysjh = BLLFactory.CreateYsjhBLL().JDBC();
                        dtRow1["Ysjh"] = ysjh;
                        zzjh = BLLFactory.CreateHcrBLL().KURJH(jdk, Tday);
                        int zzxc = 0;
                        if (zzjh != "")
                            zzxc = Convert.ToInt32(zzjh);
                        dtRow1["Zzjh"] = zzjh;
                        ds1 = BLLFactory.CreateWorkBLL().dbck(jdk, Tday);
                        good = ds1.Tables[0].Rows[0]["gcs"].ToString();
                        dtRow1["Good"] = good;
                        bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
                        dtRow1["Bad"] = bad;
                        yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "夜"));

                        ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, jdk, "外发");
                        ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
                        int xcybwcl = 0;
                        if (ybw != "")
                            xcybwcl = Convert.ToInt32(ybw);
                        ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "外发");
                        yby = ds4.Tables[0].Rows[0]["csy"].ToString();
                        int xcybycl = 0;
                        if (yby != "")
                            xcybycl = Convert.ToInt32(yby);
                        int xcybcs = 0;
                        if (yb != "")
                            xcybcs = Convert.ToInt32(yb);
                        wfhj = xcybycl + xcybcs + wfhj;
                        sjwf = xcybycl + xcybcs;
                        ybc = (xcybycl - xcybwcl + xcybcs).ToString();
                        xcybycl = 0;
                        xcybwcl = 0;
                        xcybcs = 0;
                        dtRow1["Yb"] = ybc;
                        bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "白"));

                        int xcbbcs = 0;
                        if (bb != "")
                            xcbbcs = Convert.ToInt32(bb);

                        ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "外发");
                        bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
                        int xcbbwcl = 0;
                        if (bbw != "")
                            xcbbwcl = Convert.ToInt32(bbw);
                        bbwf = bbwf + xcbbwcl;
                        ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "外发");
                        bby = ds6.Tables[0].Rows[0]["csy"].ToString();
                        ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = Convert.ToDecimal(ckyds);
                        int xcbbycl = 0;
                        if (bby != "")
                            xcbbycl = Convert.ToInt32(bby);
                        wfhj = xcbbcs - xcbbwcl + wfhj;
                        sjwf = sjwf + xcbbcs - xcbbwcl;
                        bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
                        xcbbcs = 0;
                        xcbbycl = 0;
                        xcbbwcl = 0;
                        dtRow1["Bb"] = bbc;
                        Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Nday, "夜"));
                        ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, jdk, "外发");
                        wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
                        int xcwyclcs = 0;
                        if (wycl != "")
                            xcwyclcs = Convert.ToInt32(wycl);
                        int xcNybcs = 0;
                        if (Nyb != "")
                            xcNybcs = Convert.ToInt32(Nyb);
                        int xcNwfcs = xcNybcs + xcwyclcs;
                        dtRow1["Nyb"] = xcNwfcs.ToString();
                        xcwyclcs = 0;
                        xcNybcs = 0;
                        xcNwfcs = 0;
                        ds2 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "倒库", Tday);
                        dk = ds2.Tables[0].Rows[0]["cs"].ToString();
                        int xcdkcs = 0;
                        if (dk != "")
                            xcdkcs = Convert.ToInt32(dk);
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "倒库");
                        dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
                        int xcdkycs = 0;
                        if (dkycl != "")
                            xcdkycs = Convert.ToInt32(dkycl);
                        ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "倒库");
                        dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
                        int xcdkwcs = 0;
                        if (dkwcl != "")
                            xcdkwcs = Convert.ToInt32(dkwcl);
                        edkwcl = edkwcl + xcdkwcs;
                        sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "倒库");
                        ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = kuckly + Convert.ToDecimal(ckyds);
                        int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
                        dkhj = dkhj + xcdcs;
                        dtRow1["Dk"] = xcdcs.ToString();
                        xcdkcs = 0;
                        xcdkycs = 0;
                        xcdkwcs = 0;
                        int xcqc = sjwf - zzxc;
                        zzxc = 0;
                        sjwf = 0;
                        jhcqhj = jhcqhj + xcqc;
                        dtRow1["Jhcq"] = xcqc.ToString();
                        xcqc = 0;
                        ds10 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "零提", Tday);
                        ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
                        decimal xcltds = 0;
                        if (ltd != "")
                            xcltds = Convert.ToDecimal(ltd);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        decimal xcltyds = 0;
                        if (lty != "")
                            xcltyds = Convert.ToDecimal(lty);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        if (lty != "")
                            kuckly = kuckly + Convert.ToDecimal(lty);

                        ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "零提");
                        ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();

                        decimal xcltwds = 0;
                        if (ltw != "")
                            xcltwds = Convert.ToDecimal(ltw);
                        eltwcl = eltwcl + xcltwds;
                        lt = xcltds + xcltyds - xcltwds;
                        xcltds = 0;
                        xcltyds = 0;
                        xcltwds = 0;
                        dtRow1["Lt"] = lt.ToString("f2");
                        lthj = lthj + lt;
                        lt = 0;
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, jdk));
                        dtRow2["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        Tkukc = BLLFactory.CreateBkcdtBLL().JDBC(Tday);
                        Nkukc = BLLFactory.CreateBkcdtBLL().JDBC(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        dtRow2["Kc"] = (Nkc).ToString("f2");
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow2["Rk"] = (rkl).ToString("f2");
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;

                        dtResult1.Rows.Add(dtRow1);
                        dtResult2.Rows.Add(dtRow2);
                    }; break;
                case "嘉东卷板":
                    {
                        ysjh = BLLFactory.CreateYsjhBLL().JDJB();
                        dtRow1["Ysjh"] = ysjh;
                        zzjh = BLLFactory.CreateHcrBLL().KURJH(jdk, Tday);
                        int zzxc = 0;
                        if (zzjh != "")
                            zzxc = Convert.ToInt32(zzjh);
                        dtRow1["Zzjh"] = zzjh;
                        ds1 = BLLFactory.CreateWorkBLL().dbck(jdk, Tday);
                        good = ds1.Tables[0].Rows[0]["gcs"].ToString();
                        dtRow1["Good"] = good;
                        bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
                        dtRow1["Bad"] = bad;
                        yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "夜"));

                        ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, jdk, "外发");
                        ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
                        int xcybwcl = 0;
                        if (ybw != "")
                            xcybwcl = Convert.ToInt32(ybw);
                        ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "外发");
                        yby = ds4.Tables[0].Rows[0]["csy"].ToString();
                        int xcybycl = 0;
                        if (yby != "")
                            xcybycl = Convert.ToInt32(yby);
                        int xcybcs = 0;
                        if (yb != "")
                            xcybcs = Convert.ToInt32(yb);
                        wfhj = xcybycl + xcybcs + wfhj;
                        sjwf = xcybycl + xcybcs;
                        ybc = (xcybycl - xcybwcl + xcybcs).ToString();
                        xcybycl = 0;
                        xcybwcl = 0;
                        xcybcs = 0;
                        dtRow1["Yb"] = ybc;
                        bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "白"));

                        int xcbbcs = 0;
                        if (bb != "")
                            xcbbcs = Convert.ToInt32(bb);

                        ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "外发");
                        bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
                        int xcbbwcl = 0;
                        if (bbw != "")
                            xcbbwcl = Convert.ToInt32(bbw);
                        bbwf = bbwf + xcbbwcl;
                        ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "外发");
                        bby = ds6.Tables[0].Rows[0]["csy"].ToString();
                        ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = Convert.ToDecimal(ckyds);
                        int xcbbycl = 0;
                        if (bby != "")
                            xcbbycl = Convert.ToInt32(bby);
                        wfhj = xcbbcs - xcbbwcl + wfhj;
                        sjwf = sjwf + xcbbcs - xcbbwcl;
                        bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
                        xcbbcs = 0;
                        xcbbycl = 0;
                        xcbbwcl = 0;
                        dtRow1["Bb"] = bbc;
                        Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Nday, "夜"));
                        ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, jdk, "外发");
                        wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
                        int xcwyclcs = 0;
                        if (wycl != "")
                            xcwyclcs = Convert.ToInt32(wycl);
                        int xcNybcs = 0;
                        if (Nyb != "")
                            xcNybcs = Convert.ToInt32(Nyb);
                        int xcNwfcs = xcNybcs + xcwyclcs;
                        dtRow1["Nyb"] = xcNwfcs.ToString();
                        xcwyclcs = 0;
                        xcNybcs = 0;
                        xcNwfcs = 0;
                        ds2 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "倒库", Tday);
                        dk = ds2.Tables[0].Rows[0]["cs"].ToString();
                        int xcdkcs = 0;
                        if (dk != "")
                            xcdkcs = Convert.ToInt32(dk);
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "倒库");
                        dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
                        int xcdkycs = 0;
                        if (dkycl != "")
                            xcdkycs = Convert.ToInt32(dkycl);
                        ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "倒库");
                        dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
                        int xcdkwcs = 0;
                        if (dkwcl != "")
                            xcdkwcs = Convert.ToInt32(dkwcl);
                        edkwcl = edkwcl + xcdkwcs;
                        sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "倒库");
                        ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = kuckly + Convert.ToDecimal(ckyds);
                        int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
                        dkhj = dkhj + xcdcs;
                        dtRow1["Dk"] = xcdcs.ToString();
                        xcdkcs = 0;
                        xcdkycs = 0;
                        xcdkwcs = 0;
                        int xcqc = sjwf - zzxc;
                        zzxc = 0;
                        sjwf = 0;
                        jhcqhj = jhcqhj + xcqc;
                        dtRow1["Jhcq"] = xcqc.ToString();
                        xcqc = 0;
                        ds10 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "零提", Tday);
                        ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
                        decimal xcltds = 0;
                        if (ltd != "")
                            xcltds = Convert.ToDecimal(ltd);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        decimal xcltyds = 0;
                        if (lty != "")
                            xcltyds = Convert.ToDecimal(lty);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        if (lty != "")
                            kuckly = kuckly + Convert.ToDecimal(lty);

                        ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "零提");
                        ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();

                        decimal xcltwds = 0;
                        if (ltw != "")
                            xcltwds = Convert.ToDecimal(ltw);
                        eltwcl = eltwcl + xcltwds;
                        lt = xcltds + xcltyds - xcltwds;
                        xcltds = 0;
                        xcltyds = 0;
                        xcltwds = 0;
                        dtRow1["Lt"] = lt.ToString("f2");
                        lthj = lthj + lt;
                        lt = 0;
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, jdk));
                        dtRow2["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        Tkukc = BLLFactory.CreateRkcdtBLL().JDJB(Tday);
                        Nkukc = BLLFactory.CreateRkcdtBLL().JDJB(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        dtRow2["Kc"] = (Nkc).ToString("f2");
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow2["Rk"] = (rkl).ToString("f2");
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;

                        dtResult1.Rows.Add(dtRow1);
                        dtResult2.Rows.Add(dtRow2);
                    }; break;
                case "嘉东板材":
                    {
                        ysjh = BLLFactory.CreateYsjhBLL().JDZB();
                        dtRow1["Ysjh"] = ysjh;
                        zzjh = BLLFactory.CreateHcrBLL().KURJH(jdk, Tday);
                        int zzxc = 0;
                        if (zzjh != "")
                            zzxc = Convert.ToInt32(zzjh);
                        dtRow1["Zzjh"] = zzjh;
                        ds1 = BLLFactory.CreateWorkBLL().dbck(jdk, Tday);
                        good = ds1.Tables[0].Rows[0]["gcs"].ToString();
                        dtRow1["Good"] = good;
                        bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
                        dtRow1["Bad"] = bad;
                        yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "夜"));

                        ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, jdk, "外发");
                        ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
                        int xcybwcl = 0;
                        if (ybw != "")
                            xcybwcl = Convert.ToInt32(ybw);
                        ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "外发");
                        yby = ds4.Tables[0].Rows[0]["csy"].ToString();
                        int xcybycl = 0;
                        if (yby != "")
                            xcybycl = Convert.ToInt32(yby);
                        int xcybcs = 0;
                        if (yb != "")
                            xcybcs = Convert.ToInt32(yb);
                        wfhj = xcybycl + xcybcs + wfhj;
                        sjwf = xcybycl + xcybcs;
                        ybc = (xcybycl - xcybwcl + xcybcs).ToString();
                        xcybycl = 0;
                        xcybwcl = 0;
                        xcybcs = 0;
                        dtRow1["Yb"] = ybc;
                        bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Tday, "白"));

                        int xcbbcs = 0;
                        if (bb != "")
                            xcbbcs = Convert.ToInt32(bb);

                        ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "外发");
                        bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
                        int xcbbwcl = 0;
                        if (bbw != "")
                            xcbbwcl = Convert.ToInt32(bbw);
                        bbwf = bbwf + xcbbwcl;
                        ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "外发");
                        bby = ds6.Tables[0].Rows[0]["csy"].ToString();
                        ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = Convert.ToDecimal(ckyds);
                        int xcbbycl = 0;
                        if (bby != "")
                            xcbbycl = Convert.ToInt32(bby);
                        wfhj = xcbbcs - xcbbwcl + wfhj;
                        sjwf = sjwf + xcbbcs - xcbbwcl;
                        bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
                        xcbbcs = 0;
                        xcbbycl = 0;
                        xcbbwcl = 0;
                        dtRow1["Bb"] = bbc;
                        Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(jdk, Nday, "夜"));
                        ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, jdk, "外发");
                        wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
                        int xcwyclcs = 0;
                        if (wycl != "")
                            xcwyclcs = Convert.ToInt32(wycl);
                        int xcNybcs = 0;
                        if (Nyb != "")
                            xcNybcs = Convert.ToInt32(Nyb);
                        int xcNwfcs = xcNybcs + xcwyclcs;
                        dtRow1["Nyb"] = xcNwfcs.ToString();
                        xcwyclcs = 0;
                        xcNybcs = 0;
                        xcNwfcs = 0;
                        ds2 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "倒库", Tday);
                        dk = ds2.Tables[0].Rows[0]["cs"].ToString();
                        int xcdkcs = 0;
                        if (dk != "")
                            xcdkcs = Convert.ToInt32(dk);
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "倒库");
                        dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
                        int xcdkycs = 0;
                        if (dkycl != "")
                            xcdkycs = Convert.ToInt32(dkycl);
                        ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "倒库");
                        dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
                        int xcdkwcs = 0;
                        if (dkwcl != "")
                            xcdkwcs = Convert.ToInt32(dkwcl);
                        edkwcl = edkwcl + xcdkwcs;
                        sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
                        ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "倒库");
                        ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
                        if (ckyds != "")
                            kuckly = kuckly + Convert.ToDecimal(ckyds);
                        int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
                        dkhj = dkhj + xcdcs;
                        dtRow1["Dk"] = xcdcs.ToString();
                        xcdkcs = 0;
                        xcdkycs = 0;
                        xcdkwcs = 0;
                        int xcqc = sjwf - zzxc;
                        zzxc = 0;
                        sjwf = 0;
                        jhcqhj = jhcqhj + xcqc;
                        dtRow1["Jhcq"] = xcqc.ToString();
                        xcqc = 0;
                        ds10 = BLLFactory.CreateWorkBLL().cdbykpz(jdk, "零提", Tday);
                        ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
                        decimal xcltds = 0;
                        if (ltd != "")
                            xcltds = Convert.ToDecimal(ltd);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        decimal xcltyds = 0;
                        if (lty != "")
                            xcltyds = Convert.ToDecimal(lty);
                        ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, jdk, "零提");
                        lty = ds11.Tables[0].Rows[0]["duny"].ToString();
                        if (lty != "")
                            kuckly = kuckly + Convert.ToDecimal(lty);

                        ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, jdk, "零提");
                        ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();

                        decimal xcltwds = 0;
                        if (ltw != "")
                            xcltwds = Convert.ToDecimal(ltw);
                        eltwcl = eltwcl + xcltwds;
                        lt = xcltds + xcltyds - xcltwds;
                        xcltds = 0;
                        xcltyds = 0;
                        xcltwds = 0;
                        dtRow1["Lt"] = lt.ToString("f2");
                        lthj = lthj + lt;
                        lt = 0;
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, jdk));
                        dtRow2["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        Tkukc = BLLFactory.CreateZkcdtBLL().JDZB(Tday);
                        Nkukc = BLLFactory.CreateZkcdtBLL().JDZB(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        dtRow2["Kc"] = (Nkc).ToString("f2");
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow2["Rk"] = (rkl).ToString("f2");
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;

                        dtResult1.Rows.Add(dtRow1);
                        dtResult2.Rows.Add(dtRow2);

                    }; break;
                default:
                    break;

            }
            
            
        }
        string[] s1 = { "板材库", "不锈钢热轧库", "不锈钢冷轧库", "碳钢热轧库", "碳钢冷轧库", "一高线", "二高线", "大棒线", "四轧库", "酸洗库", "化产库" };
        
        foreach (string ku in s1)
        {

            System.Data.DataRow dtRow6 = dtResult1.NewRow();
            System.Data.DataRow dtRow7 = dtResult2.NewRow();
            dtRow6["Ku"] = ku;
            dtRow7["Ku"] = ku;
            ysjh = BLLFactory.CreateHweekplanBLL().jhcs(ku, "运输处", Tday);
            dtRow6["Ysjh"] = ysjh;
            zzjh = BLLFactory.CreateHcrBLL().KURJH(ku, Tday);
            int zz = 0;
            if (zzjh != "")
                zz = Convert.ToInt32(zzjh);
            dtRow6["Zzjh"] = zzjh;
            ds1 = BLLFactory.CreateWorkBLL().dbck(ku, Tday);
            good = ds1.Tables[0].Rows[0]["gcs"].ToString();
            dtRow6["Good"] = good;
            bad = ds1.Tables[0].Rows[0]["bcs"].ToString();
            dtRow6["Bad"] = bad;
            yb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(ku, Tday, "夜"));

            ds3 = BLLFactory.CreateDxcBLL().NRWCL(ty, ku, "外发");
            ybw = ds3.Tables[0].Rows[0]["csw"].ToString();
            int xcybwcl = 0;
            if (ybw != "")
                xcybwcl = Convert.ToInt32(ybw);
            ds4 = BLLFactory.CreateDxcBLL().NRYCL(ty, ku, "外发");
            yby = ds4.Tables[0].Rows[0]["csy"].ToString();
            int xcybycl = 0;
            if (yby != "")
                xcybycl = Convert.ToInt32(yby);
            int xcybcs = 0;
            if (yb != "")
                xcybcs = Convert.ToInt32(yb);
            wfhj = xcybycl + xcybcs + wfhj;
            sjwf = xcybycl + xcybcs;
            ybc = (xcybycl - xcybwcl + xcybcs).ToString();
            xcybycl = 0;
            xcybwcl = 0;
            xcybcs = 0;
            dtRow6["Yb"] = ybc;
            bb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(ku, Tday, "白"));

            int xcbbcs = 0;
            if (bb != "")
                xcbbcs = Convert.ToInt32(bb);

            ds5 = BLLFactory.CreateDxcBLL().NRWCL(tb, ku, "外发");
            bbw = ds5.Tables[0].Rows[0]["csw"].ToString();
            int xcbbwcl = 0;
            if (bbw != "")
                xcbbwcl = Convert.ToInt32(bbw);
            bbwf = bbwf + xcbbwcl;
            ds6 = BLLFactory.CreateDxcBLL().NRYCL(tb, ku, "外发");
            bby = ds6.Tables[0].Rows[0]["csy"].ToString();
            ckyds = ds6.Tables[0].Rows[0]["duny"].ToString();
            if (ckyds != "")
                kuckly = Convert.ToDecimal(ckyds);
            int xcbbycl = 0;
            if (bby != "")
                xcbbycl = Convert.ToInt32(bby);
            wfhj = xcbbcs - xcbbwcl + wfhj;
            sjwf = sjwf + xcbbcs - xcbbwcl;
            bbc = (xcbbcs + xcbbycl - xcbbwcl).ToString();
            xcbbcs = 0;
            xcbbycl = 0;
            xcbbwcl = 0;
            dtRow6["Bb"] = bbc;
            Nyb = Convert.ToString(BLLFactory.CreateWorkBLL().wfbykpdb(ku, Nday, "夜"));
            ds7 = BLLFactory.CreateDxcBLL().NRYCL(Ny, ku, "外发");
            wycl = ds7.Tables[0].Rows[0]["csy"].ToString();
            int xcwyclcs = 0;
            if (wycl != "")
                xcwyclcs = Convert.ToInt32(wycl);
            int xcNybcs = 0;
            if (Nyb != "")
                xcNybcs = Convert.ToInt32(Nyb);
            int xcNwfcs = xcNybcs + xcwyclcs;
            dtRow6["Nyb"] = xcNwfcs.ToString();
            xcwyclcs = 0;
            xcNybcs = 0;
            xcNwfcs = 0;
            ds2 = BLLFactory.CreateWorkBLL().cdbykpz(ku, "倒库", Tday);
            dk = ds2.Tables[0].Rows[0]["cs"].ToString();
            int xcdkcs = 0;
            if (dk != "")
                xcdkcs = Convert.ToInt32(dk);
            ds8 = BLLFactory.CreateDxcBLL().NRYCL(ty, ku, "倒库");
            dkycl = ds8.Tables[0].Rows[0]["csy"].ToString();
            int xcdkycs = 0;
            if (dkycl != "")
                xcdkycs = Convert.ToInt32(dkycl);
            ds9 = BLLFactory.CreateDxcBLL().NRWCL(tb, ku, "倒库");
            dkwcl = ds9.Tables[0].Rows[0]["csw"].ToString();
            int xcdkwcs = 0;
            if (dkwcl != "")
                xcdkwcs = Convert.ToInt32(dkwcl);
            edkwcl = edkwcl + xcdkwcs;
            sjwf = sjwf + xcdkcs + xcdkycs - xcdkwcs;
            ds8 = BLLFactory.CreateDxcBLL().NRYCL(tb, ku, "倒库");
            ckyds = ds8.Tables[0].Rows[0]["duny"].ToString();
            if (ckyds != "")
                kuckly = kuckly + Convert.ToDecimal(ckyds);
            int xcdcs = xcdkcs + xcdkycs - xcdkwcs;
            dkhj = dkhj + xcdcs;
            dtRow6["Dk"] = xcdcs.ToString();
            xcdkcs = 0;
            xcdkycs = 0;
            xcdkwcs = 0;
            int xcqc = sjwf - zz;
            zz = 0;
            sjwf = 0;
            jhcqhj = jhcqhj + xcqc;
            dtRow6["Jhcq"] = xcqc.ToString();
            xcqc = 0;
            ds10 = BLLFactory.CreateWorkBLL().cdbykpz(ku, "零提", Tday);
            ltd = ds10.Tables[0].Rows[0]["ds"].ToString();
            decimal xcltds = 0;
            if (ltd != "")
                xcltds = Convert.ToDecimal(ltd);
            ds11 = BLLFactory.CreateDxcBLL().NRYCL(ty, ku, "零提");
            lty = ds11.Tables[0].Rows[0]["duny"].ToString();
            decimal xcltyds = 0;
            if (lty != "")
                xcltyds = Convert.ToDecimal(lty);
            ds11 = BLLFactory.CreateDxcBLL().NRYCL(tb, ku, "零提");
            lty = ds11.Tables[0].Rows[0]["duny"].ToString();
            if (lty != "")
                kuckly = kuckly + Convert.ToDecimal(lty);

            ds12 = BLLFactory.CreateDxcBLL().NRWCL(tb, ku, "零提");
            ltw = ds12.Tables[0].Rows[0]["dunw"].ToString();

            decimal xcltwds = 0;
            if (ltw != "")
                xcltwds = Convert.ToDecimal(ltw);
            eltwcl = eltwcl + xcltwds;
            lt = xcltds + xcltyds - xcltwds;
            xcltds = 0;
            xcltyds = 0;
            xcltwds = 0;
            dtRow6["Lt"] = lt.ToString("f2");
            lthj = lthj + lt;
            lt = 0;
            dtResult1.Rows.Add(dtRow6);
            switch (ku)
            {
                case "一高线":
                    {
                        xckc = BLLFactory.CreateXkcdtBLL().KuKC(Nday, ku);
                        decimal Nxckc = 0;
                        if (xckc != "")
                            Nxckc = Convert.ToDecimal(xckc);
                        decimal Nbckc = 0;
                        bckc = BLLFactory.CreateBkcdtBLL().KuKC(Nday, ku);
                        if (bckc != "")
                            Nbckc = Convert.ToDecimal(bckc);
                        kchj = kchj + Nxckc + Nbckc;
                        dtRow7["Kc"] = (Nxckc + Nbckc).ToString("f2");
                        xckc = BLLFactory.CreateXkcdtBLL().KuKC(Tday, ku);
                        decimal Txckc = 0;
                        if (xckc != "")
                            Txckc = Convert.ToDecimal(xckc);
                        bckc = BLLFactory.CreateBkcdtBLL().KuKC(Tday, ku);
                        decimal Tbckc = 0;
                        if (bckc != "")
                            Tbckc = Convert.ToDecimal(bckc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        dtRow7["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = (Nxckc + Nbckc) - ((Txckc + Tbckc) - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow7["Rk"] = rkl.ToString("f2");
                        dtResult2.Rows.Add(dtRow7);
                        rkl = 0;
                        Nxckc = 0;
                        Nbckc = 0;
                        Txckc = 0;
                        Tbckc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;
                case "二高线":
                    {
                        Tkukc = BLLFactory.CreateXkcdtBLL().KuKC(Tday, ku);
                        Nkukc = BLLFactory.CreateXkcdtBLL().KuKC(Nday, ku);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        dtRow7["Kc"] = (Nkc).ToString("f2");
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        dtRow7["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow7["Rk"] = rkl.ToString("f2");
                        dtResult2.Rows.Add(dtRow7);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;
                case "大棒线":
                case "四轧库":
                    {
                        Tkukc = BLLFactory.CreateBkcdtBLL().KuKC(Tday, ku);
                        Nkukc = BLLFactory.CreateBkcdtBLL().KuKC(Nday, ku);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        dtRow7["Kc"] = (Nkc).ToString("f2");
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        dtRow7["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow7["Rk"] = rkl.ToString("f2");
                        dtResult2.Rows.Add(dtRow7);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;

                case "不锈钢热轧库":
                case "碳钢热轧库":
                case "酸洗库":
                    {
                        Tkukc = BLLFactory.CreateRkcdtBLL().KuKC(Tday, ku);
                        Nkukc = BLLFactory.CreateRkcdtBLL().KuKC(Nday, ku);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        dtRow7["Kc"] = (Nkc).ToString("f2");
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        dtRow7["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow7["Rk"] = rkl.ToString("f2");
                        dtResult2.Rows.Add(dtRow7);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;
                case "板材库":
                    {
                        Tkukc = BLLFactory.CreateZkcdtBLL().KuKC(Tday);
                        Nkukc = BLLFactory.CreateZkcdtBLL().KuKC(Nday);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        dtRow7["Kc"] = (Nkc).ToString("f2");
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        dtRow7["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow7["Rk"] = rkl.ToString("f2");
                        dtResult2.Rows.Add(dtRow7);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;
                case "不锈钢冷轧库":
                case "碳钢冷轧库":
                    {
                        Tkukc = BLLFactory.CreateLkcdtBLL().KuKC(Tday, ku);
                        Nkukc = BLLFactory.CreateLkcdtBLL().KuKC(Nday, ku);
                        if (Nkukc != "")
                            Nkc = Convert.ToDecimal(Nkukc);
                        kchj = kchj + Nkc;
                        dtRow7["Kc"] = (Nkc).ToString("f2");
                        if (Tkukc != "")
                            Tkc = Convert.ToDecimal(Tkukc);
                        kuckl = Convert.ToDecimal(BLLFactory.CreateWorkBLL().CKL(Nday, ku));
                        dtRow7["Ck"] = (kuckl + kuckly).ToString("f2");
                        ckhj = kuckl + kuckly + ckhj;
                        rkl = Nkc - (Tkc - (kuckl + kuckly));
                        rkhj = rkl + rkhj;
                        dtRow7["Rk"] = rkl.ToString("f2");
                        dtResult2.Rows.Add(dtRow7);
                        rkl = 0;
                        Nkc = 0;
                        Tkc = 0;
                        kuckly = 0;
                        kuckl = 0;
                    }; break;

                default:
                    break;
            }


            
        }
        System.Data.DataRow dtRow8 = dtResult2.NewRow();
        dtRow8["Ku"] = "嘉东库回倒方坯";
        string fprk = BLLFactory.CreateGpwfBLL().FPDK(Nday);

        string fpck = BLLFactory.CreateGpwfBLL().FPCK(Nday);

        string fpkc = BLLFactory.CreateGpwfBLL().DKFPKC(Nday);
        dtRow8["Rk"] = fprk;
        dtRow8["Ck"] = fpck;
        dtRow8["Kc"] = fpkc;
        dtResult2.Rows.Add(dtRow8);
        System.Data.DataRow dtRow9 = dtResult2.NewRow();
        dtRow9["Ku"] = "嘉东库回倒板坯";
        string bprk = BLLFactory.CreateGpwfBLL().BPDK(Nday);

        string bpck = BLLFactory.CreateGpwfBLL().BPCK(Nday);

        string bpkc = BLLFactory.CreateGpwfBLL().DKBPKC(Nday);
        dtRow9["Rk"] = bprk;
        dtRow9["Ck"] = bpck;
        dtRow9["Kc"] = bpkc;
        dtResult2.Rows.Add(dtRow9);
        System.Data.DataRow dtRow10 = dtResult2.NewRow();
        dtRow10["Ku"] = "炼轧方坯";
        string lzck = BLLFactory.CreateGpwfBLL().LZCFPCK(Nday);
        string TFpkc = BLLFactory.CreateGpwfBLL().LZCFPKC(Tday);
        string NFpkc = BLLFactory.CreateGpwfBLL().LZCFPKC(Nday);
        decimal lzckl = 0;
        if (lzck != "")
            lzckl = Convert.ToDecimal(lzck);
        decimal TFK = 0;
        if (TFpkc != "")
            TFK = Convert.ToDecimal(TFpkc);
        decimal NFK = 0;
        if (NFpkc != "")
            NFK = Convert.ToDecimal(NFpkc);
        decimal Lfr = NFK - (TFK - lzckl);
        dtRow10["Rk"] = Lfr.ToString("f2");
        dtRow10["Ck"] = lzck;
        dtRow10["Kc"] = NFpkc;
        dtResult2.Rows.Add(dtRow10);
        System.Data.DataTable dtResult3 = MakeNamesTable3();
        System.Data.DataRow dtRow3 = dtResult3.NewRow();
        DataSet ds16 = BLLFactory.CreateJbBLL().JDJBInfo(Nday);
        dtRow3["Name"] = ds16.Tables[0].Rows[0]["banbie"].ToString();
        dtRow3["Value"] = ds16.Tables[0].Rows[0]["info"].ToString();
        dtResult3.Rows.Add(dtRow3);
        System.Data.DataRow dtRow4 = dtResult3.NewRow();
        dtRow4["Name"] = "自用材";
        string zyhj = BLLFactory.CreateZkcdtBLL().ZYL(Nday);
        dtRow4["Value"] = zyhj;
        dtResult3.Rows.Add(dtRow4);
        System.Data.DataRow dtRow11 = dtResult3.NewRow();
        dtRow11["Name"] = "河西库库存";
        string kchx = BLLFactory.CreateJddxBLL().hxkc();
        dtRow11["Value"] = kchx;
        dtResult3.Rows.Add(dtRow11);
        System.Data.DataRow dtRow12 = dtResult3.NewRow();
        dtRow12["Name"] = "嘉东大棒";
        string dbkc = BLLFactory.CreateBkcdtBLL().DBJD(Nday);
        dtRow12["Value"] = dbkc;
        dtResult3.Rows.Add(dtRow12);
        System.Data.DataRow dtRow13 = dtResult3.NewRow();
        dtRow13["Name"] = "总库存上涨";
        string kc1 = BLLFactory.CreateXkcdtBLL().ZKC(Tday);
        decimal c1 = 0;
        if (kc1 != "")
            c1 = Convert.ToDecimal(kc1);
        string kc2 = BLLFactory.CreateBkcdtBLL().ZKC(Tday);
        decimal c2 = 0;
        if (kc2 != "")
            c2 = Convert.ToDecimal(kc2);
        string kc3 = BLLFactory.CreateRkcdtBLL().ZKC(Tday);
        decimal c3 = 0;
        if (kc3 != "")
            c3 = Convert.ToDecimal(kc3);
        string kc4 = BLLFactory.CreateLkcdtBLL().ZKC(Tday);
        decimal c4 = 0;
        if (kc4 != "")
            c4 = Convert.ToDecimal(kc4);
        string kc5 = BLLFactory.CreateZkcdtBLL().ZKC(Tday);
        decimal c5 = 0;
        if (kc5 != "")
            c5 = Convert.ToDecimal(kc5);
        decimal kcsz = kchj - (c1 + c2 + c3 + c4 + c5);
        dtRow13["Value"] = kcsz.ToString("f2");
        dtResult3.Rows.Add(dtRow13);
        System.Data.DataTable dtResult4 = MakeNamesTable4();
        

        DataSet ds17 = BLLFactory.CreateDdhbBLL().ddinfo();
        string wbqk = ds17.Tables[0].Rows[0]["wb"].ToString();
        string scqk = ds17.Tables[0].Rows[0]["sc"].ToString();
        string sbqk = ds17.Tables[0].Rows[0]["sb"].ToString();
        string zlqk = ds17.Tables[0].Rows[0]["zl"].ToString();
        string aqqk = ds17.Tables[0].Rows[0]["aq"].ToString();
        System.Data.DataRow dtRow14 = dtResult4.NewRow();
        dtRow14["Qk"] = "外部参考信息";
        dtRow14["Value"] = wbqk;
        dtResult4.Rows.Add(dtRow14);
        System.Data.DataRow dtRow15 = dtResult4.NewRow();
        dtRow15["Qk"] = "生产分析";
        dtRow15["Value"] = scqk;
        dtResult4.Rows.Add(dtRow15);
        System.Data.DataRow dtRow16 = dtResult4.NewRow();
        dtRow16["Qk"] = "设备情况";
        dtRow16["Value"] = sbqk;
        dtResult4.Rows.Add(dtRow16);
        System.Data.DataRow dtRow17 = dtResult4.NewRow();
        dtRow17["Qk"] = "质量情况";
        dtRow17["Value"] = zlqk;
        dtResult4.Rows.Add(dtRow17);
        System.Data.DataRow dtRow18 = dtResult4.NewRow();
        dtRow18["Qk"] = "安全情况";
        dtRow18["Value"] = aqqk;
        dtResult4.Rows.Add(dtRow18);
        string yslt = BLLFactory.CreateWorkBLL().ltyshj(Tday);
        System.Data.DataRow dtRow19 = dtResult4.NewRow();
        dtRow19["Qk"] = "零提延时合计时间";
        dtRow19["Value"] = yslt;
        dtResult4.Rows.Add(dtRow19);
        ReportDocument myReport = new ReportDocument();
        string reportPath = Server.MapPath("report\\ZDHHB.rpt");
        myReport.Load(reportPath);


    }

    private System.Data.DataTable MakeNamesTable1()
    {
        // Create a new DataTable titled 'Names.'
        System.Data.DataTable namesTable = new System.Data.DataTable("ZhiBiao");

        // Add three column objects to the table.
        DataColumn KuColumn = new DataColumn();
        KuColumn.DataType = System.Type.GetType("System.String");
        KuColumn.ColumnName = "Ku";
        namesTable.Columns.Add(KuColumn);

        DataColumn YsjhColumn = new DataColumn();
        YsjhColumn.DataType = System.Type.GetType("System.String");
        YsjhColumn.ColumnName = "Ysjh";

        namesTable.Columns.Add(YsjhColumn);

        DataColumn ZzjhColumn = new DataColumn();
        ZzjhColumn.DataType = System.Type.GetType("System.String");
        ZzjhColumn.ColumnName = "Zzjh";
        namesTable.Columns.Add(ZzjhColumn);

        DataColumn GoodColumn = new DataColumn();
        GoodColumn.DataType = System.Type.GetType("System.String");
        GoodColumn.ColumnName = "Good";
        namesTable.Columns.Add(GoodColumn);

        // Create an array for DataColumn objects.
        DataColumn BadColumn = new DataColumn();
        BadColumn.DataType = System.Type.GetType("System.String");
        BadColumn.ColumnName = "Bad";
        namesTable.Columns.Add(BadColumn);

        DataColumn YbColumn = new DataColumn();
        YbColumn.DataType = System.Type.GetType("System.String");
        YbColumn.ColumnName = "Yb";
        namesTable.Columns.Add(YbColumn);

        DataColumn BbColumn = new DataColumn();
        BbColumn.DataType = System.Type.GetType("System.String");
        BbColumn.ColumnName = "Bb";
        namesTable.Columns.Add(BbColumn);

        DataColumn NybColumn = new DataColumn();
        NybColumn.DataType = System.Type.GetType("System.String");
        NybColumn.ColumnName = "Nyb";
        namesTable.Columns.Add(NybColumn);

        DataColumn DkColumn = new DataColumn();
        DkColumn.DataType = System.Type.GetType("System.String");
        DkColumn.ColumnName = "Dk";
        namesTable.Columns.Add(DkColumn);

        DataColumn LtColumn = new DataColumn();
        LtColumn.DataType = System.Type.GetType("System.String");
        LtColumn.ColumnName = "Lt";
        namesTable.Columns.Add(LtColumn);

        DataColumn JhcqColumn = new DataColumn();
        JhcqColumn.DataType = System.Type.GetType("System.String");
        JhcqColumn.ColumnName = "Jhcq";
        namesTable.Columns.Add(JhcqColumn);


        // Return the new DataTable.
        return namesTable;
    }

    
    
    private System.Data.DataTable MakeNamesTable2()
    {
        // Create a new DataTable titled 'Names.'
        System.Data.DataTable namesTable = new System.Data.DataTable("CRK");

        // Add three column objects to the table.
        DataColumn KuColumn = new DataColumn();
        KuColumn.DataType = System.Type.GetType("System.String");
        KuColumn.ColumnName = "Ku";
        namesTable.Columns.Add(KuColumn);

        DataColumn RkColumn = new DataColumn();
        RkColumn.DataType = System.Type.GetType("System.String");
        RkColumn.ColumnName = "Rk";

        namesTable.Columns.Add(RkColumn);

        DataColumn CkColumn = new DataColumn();
        CkColumn.DataType = System.Type.GetType("System.String");
        CkColumn.ColumnName = "Ck";
        namesTable.Columns.Add(CkColumn);

        DataColumn KcColumn = new DataColumn();
        KcColumn.DataType = System.Type.GetType("System.String");
        KcColumn.ColumnName = "Kc";
        namesTable.Columns.Add(KcColumn);
        // Return the new DataTable.
        return namesTable;
    }

    
    

    private System.Data.DataTable MakeNamesTable3()
    {
        // Create a new DataTable titled 'Names.'
        System.Data.DataTable namesTable = new System.Data.DataTable("QT");

        // Add three column objects to the table.
        DataColumn NameColumn = new DataColumn();
        NameColumn.DataType = System.Type.GetType("System.String");
        NameColumn.ColumnName = "Name";
        namesTable.Columns.Add(NameColumn);

        DataColumn ValueColumn = new DataColumn();
        ValueColumn.DataType = System.Type.GetType("System.String");
        ValueColumn.ColumnName = "Value";

        namesTable.Columns.Add(ValueColumn);
        // Return the new DataTable.
        return namesTable;
    }

    private System.Data.DataTable MakeNamesTable4()
    {
        // Create a new DataTable titled 'Names.'
        System.Data.DataTable namesTable = new System.Data.DataTable("DD");

        // Add three column objects to the table.
        DataColumn QkColumn = new DataColumn();
        QkColumn.DataType = System.Type.GetType("System.String");
        QkColumn.ColumnName = "Qk";
        namesTable.Columns.Add(QkColumn);

        DataColumn ValueColumn = new DataColumn();
        ValueColumn.DataType = System.Type.GetType("System.String");
        ValueColumn.ColumnName = "Value";

        namesTable.Columns.Add(ValueColumn);
        // Return the new DataTable.
        return namesTable;
    }


}
